﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace Brainee.NeuralNetwork
{
  public class TrainingSet : IEnumerable<TrainingItem>, ICollection<TrainingItem>
  {
    private List<TrainingItem> _items;

    public ICollection<TrainingItem> Items;

    public TrainingSet ()
    {
      _items = new List<TrainingItem> ();
    }

    //public bool CheckAll (Neuron n)
    //{
    //  foreach (TrainingItem item in _items)
    //  {
    //    if (n.Compute (item.Input) != item.Output)
    //      return false;
    //  }

    //  return true;
    //}

    #region IEnumerable<TrainingItem> Members

    public IEnumerator<TrainingItem> GetEnumerator ()
    {
      return _items.GetEnumerator ();
    }

    #endregion
    #region IEnumerable Members

    IEnumerator IEnumerable.GetEnumerator ()
    {
      return _items.GetEnumerator ();
    }

    #endregion

    #region ICollection<TrainingItem> Members

    public void Add (TrainingItem item)
    {
      _items.Add (item);
    }

    public void Clear ()
    {
      _items.Clear ();
    }

    public bool Contains (TrainingItem item)
    {
      return _items.Contains (item);
    }

    public void CopyTo (TrainingItem [] array, int arrayIndex)
    {
      _items.CopyTo (array, arrayIndex);
    }

    public int Count
    {
      get { return _items.Count; }
    }

    public bool IsReadOnly
    {
      get { return true; }
    }

    public bool Remove (TrainingItem item)
    {
      return _items.Remove (item);
    }

    #endregion
  }
}
